#pragma once

#define STRING_VER "1.0.1.3"

#define STR_UPPER "QWERTYUIOPASDFGHJKLZXCVBNM"
#define STR_LOWER "qwertyuiopasdfghjklzxcvbnm"
#define STR_NUM "1234567890"

class Str
{
private:
	char* chr;
	int strSize;
	
	void recalculateSize();
	
	int charSize(const char* str);
	char* getPart(int from,int to,char* str);
	int pow(int a,int b);
	Str& toI(int num,Str& str);
	Str& toD(double num,Str& str);
	
public:
	Str();
	~Str();
	char* operator!();
	Str& operator=(const Str &str);
	Str& operator=(const char* str);
	Str& operator=(const int val);
	Str& operator=(const double val);
	Str& operator=(const char val);
	Str& operator<<(const Str &str);
	Str& operator<<(const char* str);
	Str& operator<<(const int val);
	Str& operator<<(const double val);
	Str& operator<<(const char val);
	Str& operator-=(const int num);
	Str& operator--(const int num);
	bool operator==(const Str &str);
	bool operator==(const char *str);
	bool operator!=(const Str &str);
	bool operator!=(const char *str);
	bool is(const char *str);
	bool is(const Str &str);
	void set(const char* str);
	void set(const Str &str);
	void set (const char c);
	void add(const char* str);
	void add(const Str &str);
	void add(const char c);
	int size() const;
	void deleteLeft(int num);
	void deleteRight(int num);
	void clear();
	char getChar(int pos);
	
	//find commands
	int findChar(char c);
	int find(const char* str,int lowestSpot);
	int find(const char* str);
	int rfind(const char* str);
	int count(char c);
	int count(const char* str);
	int replace(const char* thisStr,const char* thatStr,int lowestSpot);
	int replace(const char* thisStr,const char* thatStr);
	int replaceAll(const char* thisStr,const char* thatStr);
	int remove(const char* str);
	int removeAll(const char* str);
	int keep(int from,int to);
	Str& copyPart(Str& Sfrom,int from,int to);
	void insert(const char *str,int at);
	void insert(const char str,int at);
	void insert(const Str& str,int at);
	Str& getFromMark(const char *mark, Str &str);
	Str& getFromMark(Str& mark, Str &str);
	int fixEdgeFormating(const char *formating);
	bool deleteChar(int spot);
	bool deleteSection(int from,int to);
	int format(const char *formating);
	int format(const Str &str);
	bool checkFormat(const char *formating);
	bool checkFormat(Str &formating);
	int atoi();
	double atod();
	void writeHex(unsigned int val);//hex to string
	int fromHex();
	void toLower();
	void toUpper();
	void takeFrom(Str &str,int spot);
	void takeFrom(Str &str,int from,int to);
};